package com.example.demo.service;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.example.demo.entity.User;
import org.springframework.stereotype.Component;

import java.util.Calendar;

@Component
public class TokenService {

    private final static String SIGN ="";

    public String getToken(User user){
        Calendar calendar =Calendar.getInstance();
        calendar.add(Calendar.DATE,1);
        String token ="";
        token = JWT.create().withAudience(String.valueOf(user.getId())).withExpiresAt(calendar.getTime()).sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }

    public String verifyToken(String token){
        return null;
    }
}
